package cn.example.vip.mall.search.controller;

import cn.example.vip.mall.search.entity.SeckillGoodsEs;
import cn.example.vip.mall.search.service.SeckillGoodsSearchService;
import cn.example.vip.mall.util.RespResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@CrossOrigin
@RestController
@RequestMapping("/seckill/goods")
public class SeckillGoodsSearchController {
	@Autowired
	private SeckillGoodsSearchService seckillGoodsSearchService;
	
	/**
	 * 将秒杀商品导入索引库
	 * @param seckillGoodsEs
	 * @return
	 */
	@PostMapping("/import")
	public RespResult add(@RequestBody SeckillGoodsEs seckillGoodsEs){
		seckillGoodsSearchService.add(seckillGoodsEs);
		return RespResult.ok();
	}
}
